import { ref } from 'vue'
import { TimeFormatType } from '../../../utils/constant'

export const statusOptions = [
    {
        label: '等待出票',
        value: 0,
        elTagClass: 'info',
    },
    {
        label: '已抢购到票',
        value: 1,
        elTagClass: 'success',
    },
    {
        label: '已取消',
        value: 2,
        elTagClass: 'danger',
    },
]

export const searchFormRules = ref([
    {
        type: 'input',
        props: {
            label: '名称',
            prop: 'name',
            placeholder: '请输入名称',
        },
    },
    {
        type: 'input',
        props: {
            label: '身份证号码',
            prop: 'docNo',
            placeholder: '请输入身份证号码',
        },
    },
    {
        type: 'select',
        props: {
            label: '状态',
            prop: 'status',
            placeholder: '请选择状态',
        },
        options: statusOptions,
    },
])

export const tableHead = [
    {
        type: 'selection',
    },
    {
        label: '分组',
        prop: 'groupIndex',
        width: 100,
    },
    {
        type: 'slot:name',
        label: '姓名',
        prop: 'touristList',
        width: 230,
        'show-overflow-tooltip': true,
    },
    {
        label: '订单编号',
        prop: 'orderNumber',
        width: 230,
        'show-overflow-tooltip': true,
    },
    {
        type: `date:${TimeFormatType['RFC2822']}`,
        label: '出票时间',
        prop: 'outTicketTime',
        'min-width': 150,
    },
    {
        label: '购票日期',
        prop: 'buyDate',
        'min-width': 150,
    },
    {
        type: 'slot:status',
        label: '状态',
        prop: 'status',
    },
    {
        type: 'actionBar',
        label: '操作',
        width: 260,
        data: [
            {
                text: '删除',
                props: {
                    icon: 'Delete',
                },
            },
            {
                text: '下载',
                props: {
                    icon: 'Download',
                },
                hidden: {
                    prop: 'status',
                    status: [0, 2],
                },
            },
            {
                text: '退票',
                props: {
                    icon: 'RefreshLeft',
                },
                hidden: {
                    prop: 'status',
                    status: [0, 2],
                },
            },
        ],
    },
]
